class Dog:

    def __init__(self, name, age): # 构造方法：__init__ 两个下划线
        self.name = name
        self.age = age
    
    def sit(self):
        print(f"{self.name} is now sitting.")

    def roll_over(self):
        print(f"{self.name} rolled over!")

dog1 = Dog('a', 12)
dog1.sit()
dog1.roll_over()
print(dog1.age, dog1.name)